package com.wjgl.action;

import com.opensymphony.xwork2.ActionSupport;
import com.wjgl.domain.Role;
import com.wjgl.service.RoleService;

public class UpdateRoleAction extends ActionSupport{
	private RoleService roleService;
	private Integer id;
	private String roleName;
	public RoleService getRoleService() {
		return roleService;
	}
	public void setRoleService(RoleService roleService) {
		this.roleService = roleService;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	@Override
	public String execute() throws Exception {
		Role role = roleService.findRoleById(id);
		role.setName(roleName);
		roleService.updateRole(role);
		return SUCCESS;
	}
	

}
